<?php

class FormBuilderController extends BaseAdminController
{

  protected function indexAction()
  {
    $form_id = $this->request->get('form_id');

    $gateway = TableDataGateway::getInstance('auto_forms', 'form_id');

    $form = $gateway->find($form_id);

    $this->response->copyAll($form);

    $elements = TableDataGateway::getInstance('auto_forms_elements', 'element_id')
      ->findAll(array('select' => 'element_id', 'where' => 'element_form_id = ?', 'data' => $form_id));

    $this->response->set('elements', $elements);
  }

}
